{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "I am a cat\n",
      "I am a dog\n",
      "I am a duck\n"
     ]
    }
   ],
   "source": [
    "## 看到一只鸟走起来像鸭子，游泳起来像鸭子，叫起来也像鸭子，那么这只鸟就可以被称为鸭子\n",
    "\n",
    "class Cat(object):\n",
    "    def say(self):\n",
    "        print('I am a cat')\n",
    "\n",
    "class Dog(object):\n",
    "    def say(self):\n",
    "        print('I am a dog')\n",
    "        \n",
    "class Duck(object):\n",
    "    def say(self):\n",
    "        print('I am a duck')\n",
    "        \n",
    "animal_list = [Cat, Dog, Duck]\n",
    "for animal in animal_list:\n",
    "    animal().say()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['bobby1', 'bobby2', 'bobby3', 'bobby4', 'bobby6', 'bobby5']\n"
     ]
    }
   ],
   "source": [
    "a = ['bobby1', 'bobby2']\n",
    "b = ['bobby2', 'bobby']\n",
    "name_tuple = ('bobby3', 'bobby4')\n",
    "name_set = set()\n",
    "name_set.add('bobby5')\n",
    "name_set.add('bobby6')\n",
    "# a.extend(b)\n",
    "a.extend(name_tuple)\n",
    "a.extend(name_set)\n",
    "\n",
    "print(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
